package com.jv.controller.admin;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jv.entity.OrderDetail;
import com.jv.entity.R;
import com.jv.service.IOrderDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;

/**
 * 管理员-订单详情控制器
 * @author Jv
 * @version 1.0
 */
@RestController
@RequestMapping("/admin/orderDetail")
public class AdminOrderDetailController {
    @Autowired
    private IOrderDetailService orderDetailService;

    //根据订单号mid查询商品订单详情
    @GetMapping("/list/{id}")
    public R listByOrderId(@PathVariable(value = "id") Integer id){
        List<OrderDetail> orderDetailList = orderDetailService.list(new QueryWrapper<OrderDetail>().eq("mId", id));
        HashMap<String, Object> map = new HashMap<>();
        map.put("list",orderDetailList);
        return R.ok(map);
    }
}
